/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package fileman;

import java.io.File;
import javax.swing.filechooser.FileFilter;

/**
 *
 * @author Conor
 */
public class RdfFileFilter extends FileFilter {

    public boolean accept(File file) {
        if (file.isDirectory()) {
            return true;
        }

        String extension = getExtension(file);
        return extension.equals("xml");
    }
    public String getDescription() {
        return "*.xml";
    }

    /*
     * Get the extension of a file.
     */
    public static String getExtension(File f) {
        String ext = null;
        String s = f.getName();
        int i = s.lastIndexOf('.');

        if (i > 0 &&  i < s.length() - 1) {
            ext = s.substring(i+1).toLowerCase();
        }
        return ext;
    }


}
